package com.hu.ta.assignment5.util;

/**
 * 
 */

import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;

/**
 * All configurable constants from the command line.
 * 
 * @author cage@g.com
 */
public enum CommandLineProperties {

	/**
	 * Command line help
	 */
	@SuppressWarnings("static-access")
	HELP(null, OptionBuilder.withLongOpt("help")
			.withDescription("show this help-menu").isRequired(false)
			.create('h'), true, false),

	@SuppressWarnings("static-access")
	INPUT_FOLDER(ConfigEnum.INPUT_FOLDER, OptionBuilder.withLongOpt("input")
			.withArgName("dir").hasOptionalArg()
			.withDescription("the trainings data folder").isRequired(true)
			.create('i'), false, true),

	@SuppressWarnings("static-access")
	OUTPUT_FOLDER(ConfigEnum.OUTPUT_FOLDER, OptionBuilder.withLongOpt("output")
			.withArgName("dir").hasOptionalArg()
			.withDescription("the tagged data output folder").isRequired(false)
			.create('o'), false, true),

	@SuppressWarnings("static-access")
	TRAIN_DATA(ConfigEnum.TRAINED_DATA, OptionBuilder.withLongOpt("data")
			.withArgName("dir").hasOptionalArg()
			.withDescription("the pos tagger data file").isRequired(true)
			.create('d'), false, true),

	@SuppressWarnings("static-access")
	LEARN(ConfigEnum.LEARN_MODE, OptionBuilder.withLongOpt("learn")
			.withDescription("the trainings data folder").isRequired(false)
			.create('l'), true, true);

	private final ConfigEnum configKey;

	private final Option option;

	private final boolean isSwitch;

	private final boolean loadableByOption;

	private CommandLineProperties(final ConfigEnum configKey,
			final Option option, final boolean isSwitch,
			final boolean loadableByOption) {
		this.configKey = configKey;
		this.option = option;
		this.isSwitch = isSwitch;
		this.loadableByOption = loadableByOption;
	}

	public char getOptionKey() {
		return option.getOpt().charAt(0);
	}

	public String getLongOptionKey() {
		return option.getLongOpt();
	}

	public Option getOption() {
		return option;
	}

	public ConfigEnum getConfigKey() {
		return configKey;
	}

	public boolean isOption() {
		return isSwitch;
	}

	public boolean isLoadableByOption() {
		return loadableByOption;
	}
}
